<template>
  <div>
    <div class="box">
      <p>上门售后固定金额：
        <el-input size="small" style="width: 500px" v-model="afterData.afterSaleFixedAmount"></el-input>
      </p>

      <el-button size="small" type="primary" style="margin-left: 50px" @click="keepData(afterData,valueData)">保 存
      </el-button>
    </div>
  </div>
</template>

<script>
export default {
  name: "afterSalesCommssion",
  props: {
    afterData: {
      type: Object,
      default: () => ({})
    },
    valueData: {
      type: String,
      default: ''
    },
  },
  data() {
    return {
      afterList: [],
      afterSaleFixedAmount: "",
    }
  },
  watch: {
    afterData: {
      handler(val) {
        console.log(val)
        this.afterList = val
      },
      deep: true,
      immediate: true,
    }
  },
  methods: {
    keepData(val, type) {
      const data = {
        id: val.id,
        afterSaleFixedAmount: val.afterSaleFixedAmount,
        commissionType: type
      }
      this.$api.commissionUpdateCommissionConfig(data).then(res => {
        if (res == 1) {
          this.$message.success('提交成功！')
          this.$emit('addStatus', 1)
        }
      })
    }
  }
}
</script>
<style scoped lang="less">
.box {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 100%;
  margin: 20px 0;

  p {
    margin-bottom: 15px;
  }
}

</style>